﻿using System;
using System.Text;
using System.IO;

namespace IconExtractor
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] files = Directory.GetFiles(Directory.GetCurrentDirectory(),
            "*.ico");
            foreach (string file in files)
            {
                Console.WriteLine(file);
                string textName = Path.ChangeExtension(file, ".txt");
                using (StreamWriter sw = new StreamWriter(textName))
                {
                    byte[] data = File.ReadAllBytes(file);
                    for (int i = 0; i < data.Length; i++)
                        sw.Write(data[i].ToString("X2"));
                    sw.Close();
                }
            }
        }
    }
}

